package asteroids.expressions;

import be.kuleuven.cs.som.annotate.Basic;

public abstract class UnaryExpression extends ComposedExpression {

	private Expression expression;
	
	protected UnaryExpression(int line, int column, Expression expression) {
		super(line, column);
		this.expression = expression;
	}

	@Basic
	public Expression getExpression() {
		return expression;
	}

	@Override
	public int getNbExpressions() {
		return 1;
	}

	@Override
	public Expression getExpressionAt(int index) throws IndexOutOfBoundsException {
		if (index == 1)
			return getExpression();
		else
			throw new IndexOutOfBoundsException();
	}
	
}
